# 一次遍历
# class Solution(object):
#     def fixedPoint(self, arr):
#         """
#         :type arr: List[int]
#         :rtype: int
#         """
#         for i in range(len(arr)):
#             if arr[i] == i:
#                 return i
#         return -1

class Solution(object):
    def fixedPoint(self, arr):
        """
        :type arr: List[int]
        :rtype: int
        """
        i = 0
        while i < len(arr):
            if arr[i] == i:
                return i
            else:
                if arr[i] < i:
                    i += 1
                else:
                    return -1
        return -1
